package com.sx.gongzhong.pest;

import android.content.Context;


import com.sx.gongzhong.model.HeadParamBean;
import com.sx.gongzhong.model.PhotoBean;
import com.sx.gongzhong.model.ReplyUserBean;
import com.sx.gongzhong.net.ApiManager;
import com.sx.gongzhong.net.BaseCallBack;
import com.sx.gongzhong.view.UploadFileView;

import java.io.File;
import java.util.List;
import java.util.Map;

/**
 * @desc: 上传文件的presenter
 */

public class UploadFilePest {

    private UploadFileView uploadView;

    public UploadFilePest(UploadFileView uploadView) {
        this.uploadView = uploadView;
    }

    public void uploadFile(Context context,List<File> files) {
        Map<String,Object> map = HeadParamBean.getHead();
        new ApiManager().upLoadMultiFile(map,files, new BaseCallBack<ReplyUserBean.BaseResult<List<PhotoBean>>>() {
            @Override
            public void onSuccess(ReplyUserBean.BaseResult<List<PhotoBean>> response) {
                uploadView.uploadSuccess(response.getData());
            }

            @Override
            public void onFailures(String message) {
                uploadView.showError(message);
            }
        });
    }
}

